#include "dialoglogin.h"
#include "ui_dialoglogin.h"

DialogLogin::DialogLogin(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::DialogLogin)
{
    ui->setupUi(this);
    ui->lineEdit_passwd->setEchoMode(QLineEdit::Password);
    submitType_ = 0;
}

DialogLogin::~DialogLogin()
{
    delete ui;
}

void DialogLogin::on_radioButton_admin_clicked()
{
    stuData_.type = "管理员";
}

void DialogLogin::on_radioButton_user_clicked()
{
    stuData_.type = "普通用户";
}

void DialogLogin::on_pushButton_register_clicked()
{
    stuData_.name = ui->lineEdit_name->text();
    stuData_.passwd = ui->lineEdit_passwd->text();
    stuData_.stuid = ui->lineEdit_stuid->text();
    emit submitUserRegisterInfo(stuData_);
}

void DialogLogin::on_pushButton_login_clicked()
{
    stuData_.name = ui->lineEdit_name->text();
    stuData_.passwd = ui->lineEdit_passwd->text();
    stuData_.stuid = ui->lineEdit_stuid->text();
    emit submitUserLoginInfo(stuData_);
}
